<template>
  <div class="account-query-container">
    <div class="account-query">
      <ui-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px">
        <ui-form-item>
          <ui-row type="flex" class="row-bg">
            <ui-col :span="6">
              <ui-form-item prop="customerName" label="机构编号" >
                <ui-input v-model="ruleForm.customerName" placeholder="请输入机构编号"></ui-input>
              </ui-form-item>
            </ui-col>
            <ui-col :span="6">
              <ui-form-item prop="customerName" label="机构名称" >
                <ui-input v-model="ruleForm.customerName" placeholder="请输入机构名称"></ui-input>
              </ui-form-item>
            </ui-col>
            <ui-col :span="6">
              <ui-form-item prop="customerName" label="机构地址" >
                <ui-input v-model="ruleForm.customerName" placeholder="请输入机构地址"></ui-input>
              </ui-form-item>
            </ui-col>
          </ui-row>
        </ui-form-item>
        <ui-form-item>
          <ui-row type="flex" class="row-bg">
            <ui-col :span="6">
              <ui-form-item prop="type" label="机构类型" >
                <ui-select v-model="ruleForm.type" placeholder="请选择">
                  <ui-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
                  </ui-option>
                </ui-select>
              </ui-form-item>
            </ui-col>
            <ui-col :span="6">
              <ui-form-item prop="institution" label="机构类型">
                <ui-select v-model="ruleForm.institution" placeholder="请选择">
                  <ui-option label="区域一" value="shanghai"></ui-option>
                  <ui-option label="区域二" value="beijing"></ui-option>
                </ui-select>
              </ui-form-item>
            </ui-col>
          </ui-row>
        </ui-form-item>
        <ui-form-item>
          <ui-row type="flex" class="row-bg" justify="center">
            <ui-button type="primary" @click="submitForm('ruleForm')">查询</ui-button>
            <ui-button @click="resetForm('ruleForm')">重置</ui-button>
          </ui-row>
        </ui-form-item>
      </ui-form>
    </div>
    <div class="account-list">
      <div class="list-tabble">
        <vx-table :table-data="tableData" :columns="columns" :customer-style="true" btnFixed="right">
          <template slot="operation" slot-scope="scope">
            <div class="custom-class">
              <div class="operation-icon">
                <ui-link type="danger" :underline="false" @click="goInfo">详情</ui-link>
              </div>
            </div>
          </template>
        </vx-table>
      </div>
    </div>
    <!-- 分页器 -->
    <div class="page">
      <ui-pagination @current-change="handleCurrentChange" :current-page="currentPage" background :page-size="10"
        layout="total, prev, pager, next, jumper" :total="totalPage">
      </ui-pagination>
    </div>
    <!-- 机构详情 -->
    <ui-dialog title="机构详情" align="center" :visible.sync="editHistoryVisible" width="65%">
      <div class="xqInfo">
        <div class="xqCont">机构编号：0000001</div>
        <div class="xqCont">机构名称：0000001</div>
        <div class="xqCont">机构类型：0000001</div>
        <div class="xqCont">机构级别：0000001</div>
      </div>
      <vx-table :table-data="tableData" :columns="columns" btnFixed="right">
        </vx-table>
      <span slot="footer" class="dialog-footer">
        <ui-button @click="editHistoryVisible = false">取 消</ui-button>
        <ui-button type="primary" @click="editHistoryVisible = false">确 定</ui-button>
      </span>
    </ui-dialog>
  </div>
</template>

<script>
import vxTable from '@/components/vx-table';
import { currency, wordcut } from '@csii/vx-util'
export default {
  name: 'institutionList',
  components: {
    vxTable,
  },
  data() {
    return {
      ruleForm: {},
      totalPage: 100,
      currentPage: 1,
      tableData: [
        {
          customerNo: '10086',
          customerName: '科蓝公司',
          customerType: '零售',
          phone: '15112345263',
        },
      ],
      columns: [
        {
          type: 'index',
          width:'150',
          label: '序号',
        },
        {
          prop: 'customerNo',
          label: '机构编号',
        },
        {
          prop: 'customerName',
          label: '机构名称',
        },
        {
          prop: 'customerType',
          label: '机构类型',
        },
        {
          prop: 'phone',
          label: '机构电话',
          formatter: (row, column, cellValue, index) => {
            return wordcut(cellValue, 3, 4);
          }
        }
      ],
      options: [
        {
          value: '选项1',
          label: '黄金糕',
        },
        {
          value: '选项2',
          label: '双皮奶',
        },
        {
          value: '选项3',
          label: '蚵仔煎',
        },
        {
          value: '选项4',
          label: '龙须面',
        },
        {
          value: '选项5',
          label: '北京烤鸭',
        },
      ],
      editHistoryVisible:false,
    };
  },
  methods: {
    // 跳转高级查询
    goAdancedQuery() {
      this.$router.push('/task/advancedQuery')
    },
    // 页面改变
    handleCurrentChange() {

    },
    // 归属历史查询
    goInfo() {
      this.editHistoryVisible=true;
    }
  },
};
</script>

<style lang="scss" scoped>
.account-query-container {
  .account-query {
    .input-width {
      padding-left: 10px;
      width: 97%;
    }
  }

  .account-list {
    margin-top: 10px;

    .list-title {
      margin-bottom: 10px;
      color: #333;
      font-weight: 600;
      font-size: 20px;
    }

    .list-tabble {
      .custom-class {
        .operation-icon {
          display: flex;
          width: 100%;
          justify-content: space-between;
          align-items: center;
        }
      }
    }
  }

  .page {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
  }

}

::v-deep .ui-select {
  display: block;
}
.xqInfo{
  width: 80%;
  margin: 20px auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.xqCont{
  width: 40%;
  font-size: 16px;
  margin-top: 20px;
  text-align: center;
}
</style>
